/**
 * 
 */
package com.cait.dutyfree.test;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

/**
 * @author Rasika Kaluwalgoda
 *
 */
public class Log4jConfigLoader extends HttpServlet {

    /**
	 * 
	 */
	private static final long serialVersionUID = -9007555002879364426L;
	
	private Thread thread;
    
    @Override
    public void destroy() {
		thread.interrupt();
		super.destroy();
    }

    public void init() throws ServletException {
		super.init();
		MonitorThread monitorThread = new MonitorThread();
		monitorThread.setCheckIntervalMillis(10000);
		monitorThread.setUrl(getServletContext().getRealPath("WEB-INF")+"/log4j.xml");
		thread = new Thread(monitorThread);
		thread.start();
    }
}
